import Vue from 'vue'
import Router from 'vue-router'
import me from './me'
import enterprise from './enterprise'

Vue.use(Router)

/**
 * Note: 路由配置项
 *
 * hidden: true                   // 当设置 true 的时候该路由不会再侧边栏出现 如401，login等页面，或者如一些编辑页面/edit/1
 * alwaysShow: true               // 当你一个路由下面的 children 声明的路由大于1个时，自动会变成嵌套的模式--如组件页面
 *                                // 只有一个时，会将那个子路由当做根路由显示在侧边栏--如引导页面
 *                                // 若你想不管路由下面的 children 声明的个数都显示你的根路由
 *                                // 你可以设置 alwaysShow: true，这样它就会忽略之前定义的规则，一直显示根路由
 * redirect: noRedirect           // 当设置 noRedirect 的时候该路由在面包屑导航中不可被点击
 * name:'router-name'             // 设定路由的名字，一定要填写不然使用<keep-alive>时会出现各种问题
 * meta : {
    roles: ['admin','editor']    // 设置该路由进入的权限，支持多个权限叠加
    title: 'title'               // 设置该路由在侧边栏和面包屑中展示的名字
    icon: 'svg-name'             // 设置该路由的图标，对应路径src/icons/svg
    breadcrumb: false            // 如果设置为false，则不会在breadcrumb面包屑中显示
  }
 */

// 公共路由
export const constantRoutes = [
    {
        path: '/redirect',
        component: () => import('@/views/redirect'),
        hidden: true,
        children: [
            {
                path: '/redirect/:path(.*)',
                component: () => import('@/views/redirect')
            }
        ]
    },
    {
        path: '/login',
        component: () => import('@/views/login'),
        meta: { 'fixedNav': false },
        hidden: false
    },
    {
        path: '/MainLogin',
        component: () => import('@/views/login2'),
        meta: { 'fixedNav': false },
        hidden: true
    },
    {
        path: '/reg',
        component: () => import('@/views/register'),
        meta: { 'fixedNav': false },
        hidden: true
    },
    {
        path: '/404',
        component: () => import('@/views/error/404'),
        hidden: true
    },
    {
        path: '/401',
        component: () => import('@/views/error/401'),
        hidden: true
    },
    {
        path: '/',
        component: () => import('@/views/enterprise/index'),
        hidden: true
    },
    {
        path: '/index',
        component: () => import('@/views/enterprise/index'),
        hidden: true
    },

    /**
     * 智慧政策
     */
    {
        path: '/policy',
        component: () => import('@/views/policy/mian'),
        meta: { title: '政策' },
        hidden: true,
        children: [
            {
                path: '',
                component: () => import('@/views/policy/index'),
                name: 'index',
                meta: { title: '政策' }
            },
            {
                path: 'qa',
                component: () => import('@/views/policy/qa'),
                name: 'qa',
                meta: { title: '问题匹配' }
            },
            {
                path: 'support',
                component: () => import('@/views/policy/support'),
                name: 'support',
                meta: { title: '扶持政策匹配' }
            },
            {
                path: 'radio',
                component: () => import('@/views/policy/radio'),
                name: 'radio',
                meta: { title: '企业政策匹配' }
            },
            {
                path: 'reqcapital',
                component: () => import('@/views/policy/reqCapital'),
                name: 'reqcapital',
                meta: { title: '注册资金' }
            },
            {
                path: 'matching',
                component: () => import('@/views/policy/matching'),
                name: 'matching',
                meta: { title: '匹配结果' }
            },
            {
                path: 'details',
                component: () => import('@/views/policy/details'),
                name: 'details',
                meta: { title: '政策详情' }
            }
        ]
    },

    /**
     * 智慧政策手机端
     */
    {
        path: '/policymobile',
        component: () => import('@/views/policymobile/index'),
        meta: { title: '人才政策' },
        hidden: true,
        children: []
    },
    {
        path: '/chooseProject',
        component: () => import('@/views/policymobile/chooseProject'),
        meta: { title: '扶持政策' },
        hidden: true,
        children: []
    },
    {
        path: '/citya',
        component: () => import('@/views/policymobile/city'),
        meta: { title: '扶持政策' },
        hidden: true,
        children: []
    },
    {
        path: '/areaa',
        component: () => import('@/views/policymobile/area'),
        meta: { title: '扶持政策' },
        hidden: true,
        children: []
    },
    {
        path: '/chooseEducation1',
        component: () => import('@/views/policymobile/chooseEducation1'),
        meta: { title: '扶持政策' },
        hidden: true,
        children: []
    },
    {
        path: '/chooseEducation2',
        component: () => import('@/views/policymobile/chooseEducation2'),
        meta: { title: '企业政策匹配' },
        hidden: true,
        children: []
    },
    {
        path: '/questions',
        component: () => import('@/views/policymobile/questions'),
        meta: { title: '问题匹配' },
        hidden: true,
        children: []
    },
    {
        path: '/matchresults',
        component: () => import('@/views/policymobile/matchResults'),
        meta: { title: '匹配结果' },
        hidden: true,
        children: []
    },
    {
        path: '/matchresults',
        component: () => import('@/views/policymobile/matchResults'),
        meta: { title: '匹配结果' },
        hidden: true,
        children: []
    },
    {
        path: '/talentVue',
        component: () => import('@/views/policymobile/talentVue'),
        meta: { title: '搜索' },
        hidden: true,
        children: []
    },
    {
        path: '/policyDetails',
        component: () => import('@/views/policymobile/policyDetails'),
        meta: { title: '详情' },
        hidden: true,
        children: []
    },

    //服务联盟
    {
        path: '/service',
        component: () => import('@/views/service/mian'),
        meta: { title: '服务联盟' },
        hidden: true,
        children: [
            {
                path: '',
                component: () => import('@/views/service/index'),
                name: 'service',
                meta: { title: '服务商超' }
            },
            {
                path: 'product',
                component: () => import('@/views/service/product'),
                name: 'product',
                meta: { title: '人才服务' }
            },
            {
                path: 'productdetails',
                component: () => import('@/views/service/productdetails'),
                name: 'productdetails',
                meta: { title: '人才服务详情' }
            },
            {
                path: 'enterprise',
                component: () => import('@/views/service/enterprise'),
                name: 'enterprise',
                meta: { title: '企业大学' }
            },
            {
                path: 'enterdetails',
                component: () => import('@/views/service/enterdetails'),
                name: 'enterdetails',
                meta: { title: '企业大学详情' }
            },
            {
                path: 'activity',
                component: () => import('@/views/service/activity'),
                name: 'activity',
                meta: { title: '活动中心' }
            },
            {
                path: 'details',
                component: () => import('@/views/service/details'),
                name: 'details',
                meta: { title: '服务商超详情' }
            },
            {
                path: 'activitydetails',
                component: () => import('@/views/service/activitydetails'),
                name: 'activitydetails',
                meta: { title: '活动详情' }
            },
            {
                path: 'activityform',
                component: () => import('@/views/service/activityform'),
                name: 'activityform',
                meta: { title: '活动报名' }
            },
            {
                path: '/sign',
                component: () => import('@/views/service/sign'),
                hidden: true,
                meta: { title: '活动签到' }
            },
        ]
    },
    
    //关于我们
    {
        path: '/about',
        component: () => import('@/views/about'),
        hidden: true,
        meta: { title: '关于我们' }
    },
    //咨询
    {
        path: '/bbs',
        component: () => import('@/views/bbs'),
        hidden: true,
        meta: { title: '咨询中心' }
    },
    //资讯中心
    {
        path: '/information',
        component: () => import('@/views/information/mian'),
        hidden: true,
        meta: { title: '资讯中心' },
        children: [
            {
                path: '/',
                component: () => import('@/views/information/index'),
                hidden: true,
                meta: { title: '资讯中心' }
            },
            {
                path: 'indexa',
                component: () => import('@/views/information/indexa'),
                hidden: true,
                meta: { title: '园区介绍' }
            },
            {
                path: 'indexb',
                component: () => import('@/views/information/indexb'),
                hidden: true,
                meta: { title: '通知公告' }
            },
            {
                path: 'indexc',
                component: () => import('@/views/information/indexc'),
                hidden: true,
                meta: { title: '创业' }
            },
            {
                path: 'indexd',
                component: () => import('@/views/information/indexd'),
                hidden: true,
                meta: { title: '求学' }
            },
            {
                path: 'indexe',
                component: () => import('@/views/information/indexe'),
                hidden: true,
                meta: { title: '新闻动态' }
            },
            {
                path: 'details',
                component: () => import('@/views/information/details'),
                hidden: true,
                meta: { title: '资讯详情' }
            }
        ]
    },
    {
        path: '/job',
        component: () => import('@/views/jobs'),
        hidden: true
    },
    {
        path: '/fieldwork',
        component: () => import('@/views/fieldwork'),
        hidden: true
    }
]

export default new Router({
    mode: 'history', // 去掉url中的#
    scrollBehavior: () => ({ y: 0 }),
    routes: [
        ...constantRoutes,// 公共路由
        ...me, // 个人中心
        ...enterprise // 企业中心
    ]
})
